﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using Newtonsoft.Json;
using System.Runtime.Serialization;
using T.FAS.Runtime.Term.Entity;
using T.FAS.Runtime.Metadata.Entity.Page.Page;

namespace T.FAS.Runtime.Metadata.Entity.Page
{
    /// <summary>
    /// 表单元数据
    /// </summary>
    [DataContract]
    [Serializable]
    public class PageMetaData : AbsMetaDataContent
    {
        [DataMember]
        public override string MetaDataID { get; set; }
        [DataMember]
        public override string MetaDataCode { get; set; }
        [DataMember]
        public override string MetaDataName { get; set; }
        [DataMember]
        public override string ProjectBranchID { get; set; }
        /// <summary>
        /// 主键
        /// </summary>
        [DataMember]
        public string ID { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [DataMember]
        public override string Creator { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [DataMember]
        public override DateTime CreateTime { get; set; }
        /// <summary>
        /// 最后修改人
        /// </summary>
        [DataMember]
        public override string LastModifier { get; set; }
        /// <summary>
        /// 最后修改时间
        /// </summary>
        [DataMember]
        public override DateTime LastModifyTime { get; set; }
        /// <summary>
        /// Code
        /// </summary>
        [DataMember]
        public string Code { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        [DataMember]
        public string Name { get; set; }
        /// <summary>
        /// 租户id
        /// </summary>
        public string TenantID { get; set; }
        /// <summary>
        /// 子系统
        /// </summary>
        [DataMember]
        public string SubSystemCode { get; set; }
        /// <summary>
        /// 语言包明细
        /// </summary>
        [DataMember]
        public List<PageRefInstance> PageRefInstances { get; set; } = new List<PageRefInstance>();
        /// <summary>
        /// 语言包Schema
        /// </summary>
        [DataMember]
        public List<PageRefSchema> PageRefSchemas { get; set; } = new List<PageRefSchema>();
        /// <summary>
        /// page基础信息
        /// </summary>
        [DataMember]
        public PageHeader Header { get; set; }
        /// <summary>
        /// 界面入参列表
        /// </summary>
        [DataMember]
        public List<PageVariable> PageParameters { get; set; } = new List<PageVariable>();
        /// <summary>
        /// 界面出参列表
        /// </summary>
        [DataMember]
        public List<PageVariable> PageOutParameters { get; set; } = new List<PageVariable>();
        /// <summary>
        /// 界面变量列表
        /// </summary>
        [DataMember]
        public List<PageVariable> LocalVariables { get; set; } = new List<PageVariable>();
        /// <summary>
        /// 界面对应的模型集合 Action与DQ
        /// </summary>
        [DataMember]
        public List<PageViewModel> ViewModels { get; set; } = new List<PageViewModel>();
        /// <summary>
        /// 界面方法列表
        /// </summary>
        [DataMember]
        public List<PageMethod> Methods { get; set; } = new List<PageMethod>();
        /// <summary>
        /// 用户组件事件列表
        /// </summary>
        [DataMember]
        public List<PageCtrlEvent> CtrlEvents { get; set; } = new List<PageCtrlEvent>();
        /// <summary>
        /// 界面事件列表 包括界面事件和控件事件
        /// </summary>
        [DataMember]
        public List<PageEvent> Events { get; set; } = new List<PageEvent>();
        /// <summary>
        /// 依赖元数据
        /// </summary>
        [DataMember]
        public List<PageUIControlDependency> MetaDependencys { get; set; } = new List<PageUIControlDependency>();
        /// <summary>
        /// 元数据依赖
        /// </summary>
        [DataMember]
        public List<PageMetaDependency> MetaDependency { get; set; } = new List<PageMetaDependency>();
        /// <summary>
        /// PC-UI Dom结构
        /// </summary>
        [DataMember]
        public PageUIDom PCUIDom { get; set; } = new PageUIDom();
        [DataMember]
        public List<PageConditionStyle> ConditionStyles { get; set; } = new List<PageConditionStyle>();

        [DataMember]
        public List<Dictionary<string, object>> MicroflowJSON { get; set; }
        #region Page预置词条发布
        /// <summary>
        /// 翻译好的词条内容，仅发布用的字段
        /// </summary>
        [DataMember]
        public Dictionary<string, List<Dictionary<string, string>>> TranslatedTerms { get; set; }

        #endregion
        #region 丢弃
        /// <summary>
        /// 界面入口
        /// </summary>
        [DataMember]
        public PageEntry PageEntry { get; set; }
        /// <summary>
        /// 移动-UI Dom结构
        /// </summary>
        [DataMember]
        public PageUIDom MobileUIDom { get; set; } = new PageUIDom();
        /// <summary>
        /// 响应式-UI Dom结构
        /// </summary>
        [DataMember]
        public PageUIDom ReactiveUIDom { get; set; } = new PageUIDom();
        /// <summary>
        /// 界面扩展属性
        /// </summary>
        [DataMember]
        public Dictionary<string, PageExtProperty> ExtProperties { get; set; } = new Dictionary<string, PageExtProperty>();
        /// <summary>
        /// 控件方法列表 丢弃
        /// </summary>
        [DataMember]
        public List<PageMethod> CtrlMethods { get; set; } = new List<PageMethod>();
        #endregion
        public override object Clone()
        {
            return this.MemberwiseClone();
        }
    }
}
